package org.hadoop.rpc.client;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.hadoop.rpc.service.IHello;
import java.net.InetSocketAddress;
public class RpcClient {
    public static void main(String[] args) throws Exception {
        System.setProperty("hadoop.home.dir","D:/program/hadoop-3.2.2");
        IHello hello =
                RPC.getProxy(IHello.class,//指定协议或接口
                        1L,//指定客户端ID,任意Long值
                        new InetSocketAddress("127.0.0.1", 5678),
                        new Configuration());
        String str = hello.say("hadoop");
        System.out.println("返回的数据是："+str);
        RPC.stopProxy(hello);//正常关闭连接
    }
}
